import { createRouter, createWebHistory } from "vue-router";
import type { RouteRecordRaw } from "vue-router";

const Layout = () => import("@/views/Layout/index.vue"); // Layout


export const constantRoutes: RouteRecordRaw[] = [
  {
    path: "/",
    component: Layout,
    children: [
      { hidden: false, path: "", name: "Index", redirect: "/login" }
    ]
  },
  {
    path: "/login",
    component: () => import('@/views/Login/index.vue'),
    children: [
      { hidden: false, path: "", name: "login" }
    ]
  },
  {
    path: "/",
    component: Layout,
    children: [
      {
        hidden: true,
        path: '/Target',
        component: () => import('@/views/Target/index.vue'),
        name: 'Target',
        meta: { title: '目标内容', icon: 'SmileOutlined', affix: true }
      },
    ]
  },
  {
    path: "/",
    component: Layout,
    children: [
      {
        hidden: true,
        path: '/TimeLen',
        component: () => import('@/views/TimeLen/index.vue'),
        name: 'TimeLen',
        meta: { title: '使用时长', icon: 'MailOutlined', affix: true }
      },
    ]
  },
  {
    path: "/",
    component: Layout,
    children: [
      {
        hidden: true,
        path: '/Visiti',
        component: () => import('@/views/Visiti/index.vue'),
        name: 'Visiti',
        meta: { title: '访问次数', icon: 'MenuUnfoldOutlined', affix: true }
      },
    ]
  },
  {
    path: "/",
    component: Layout,
    children: [
      {
        hidden: true,
        path: '/Emotion',
        component: () => import('@/views/Emotion/index.vue'),
        name: 'Emotion',
        meta: { title: '情绪记录', icon: 'ClockCircleOutlined', affix: true }
      },
    ]
  },
  {
    path: "/",
    component: Layout,
    children: [
      {
        hidden: true,
        path: '/Account',
        component: () => import('@/views/Account/index.vue'),
        name: 'Account',
        meta: { title: '添加账号', icon: 'UploadOutlined', affix: true }
      },
    ]
  },
  {
    path: "/",
    component: Layout,
    children: [
      {
        hidden: true,
        path: '/sign',
        component: () => import('@/views/sign/index.vue'),
        name: 'Account',
        meta: { title: '签目管理', icon: 'UploadOutlined', affix: true }
      },
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes: constantRoutes,
});

export default router;
